<%--
  Created by IntelliJ IDEA.
  User: 22328
  Date: 2021/2/12
  Time: 22:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>焕耀商城－我的订单</title>
    <link rel="stylesheet" type="text/css" href="./css/reset.css">
    <link rel="stylesheet" type="text/css" href="./css/main.css">
    <link rel="stylesheet" type="text/css" href="./lib/layui/css/layui.css">
    <script src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
</head>
<body>

<!--头部  开始-->
<jsp:include page="top.jsp"/>
<!--头部  结束-->

<!--内容  开始-->
<div class="search_bar clearfix">
    <a href="./main" class="logo fl"><img src="./images/logo.png"></a>
    <div class="sub_page_name fl">|&nbsp;&nbsp;&nbsp;&nbsp;用户中心</div>
    <div class="search_con fr">
        <form method="get" action="http://ttsx.newzn.cn/search/" target="_blank">
            <input type="text" class="input_text fl" name="q" placeholder="搜索商品">
            <input type="submit" class="input_btn fr" value="搜索">
        </form>
    </div>
</div>
<div class="main_con clearfix">
    <div class="left_menu_con clearfix">
        <h3>用户中心</h3>
        <ul>

            <li><a href="./getPersonalHtml">· 个人信息</a></li>
            <li><a href="#" class="active">· 全部订单</a></li>
            <li><a href="./getAddressHtml?userId=${sessionScope.user.id}">· 收货地址</a></li>

        </ul>
    </div>

    <div class="right_content clearfix">
        <h3 class="common_title2">全部订单</h3>

        <div class="site_con">
            <dt>全部订单：</dt>
            <dl>
                <c:forEach items="${ordersList}" var="order">
                    <hr>
                    <dd>
                        <span style="padding-right: 15px">订单编号：${order.orderNumber}</span>
                    </dd>
                    <dd>
                        <span style="padding-right: 15px">创建时间：${order.gmtCreate}</span></dd>
                    <dd>
                        <c:if test="${order.payType==1}">
                            <span style="padding-right: 15px">支付方式：支付宝</span>
                        </c:if>
                        <c:if test="${order.payType==2}">
                            <span style="padding-right: 15px">支付方式：微信</span>
                        </c:if>
                        <c:if test="${order.payType==3}">
                            <span style="padding-right: 15px">支付方式：网银</span>
                        </c:if>
                    </dd>
                    <dd>
                        <span style="padding-right: 15px">支付时间：${order.payTime}</span></dd>
                    </dd>
                    <dd>
                        <span style="padding-right: 15px">总金额：${order.payMoney}RMB</span></dd>
                    <dd>
                        <c:if test="${order.logisticsType==0}">
                            <span style="padding-right: 15px">物流方式：待处理</span>
                        </c:if>
                        <c:if test="${order.logisticsType==1}">
                            <span style="padding-right: 15px">物流方式：顺丰速运</span>
                        </c:if>
                        <c:if test="${order.logisticsType==2}">
                            <span style="padding-right: 15px">物流方式：圆通快递</span>
                        </c:if>
                        <c:if test="${order.logisticsType==3}">
                            <span style="padding-right: 15px">物流方式：中通快递</span>
                        </c:if>
                        <c:if test="${order.logisticsType==4}">
                            <span style="padding-right: 15px">物流方式：百事通</span>
                        </c:if>
                        <c:if test="${order.logisticsType==5}">
                            <span style="padding-right: 15px">物流方式：中国邮政</span>
                        </c:if>
                        <c:if test="${order.logisticsType==6}">
                            <span style="padding-right: 15px">物流方式：宅急送</span>
                        </c:if>
                    </dd>
                    <dd>
                        <c:if test="${order.orderStatus==0}">
                            <span style="padding-right: 15px">订单状态：代发货</span>
                        </c:if>
                        <c:if test="${order.orderStatus==1}">
                            <span style="padding-right: 15px">订单状态：已发货</span>
                        </c:if>
                        <c:if test="${order.orderStatus==2}">
                            <span style="padding-right: 15px">订单状态：代签收</span>
                        </c:if>
                        <c:if test="${order.orderStatus==3}">
                            <span style="padding-right: 15px">订单状态：已签收</span>
                        </c:if>
                        <c:if test="${order.orderStatus==4}">
                            <span style="padding-right: 15px">订单状态：待评价</span>
                        </c:if>
                        <c:if test="${order.orderStatus==5}">
                            <span style="padding-right: 15px">订单状态：已完成</span>
                        </c:if>
                    </dd>
                    <dd>
                        <a style="cursor: pointer;color: green;"
                           onclick="xadmin.open('订单查看','./orderViewHtml?id=${order.id}',1200,500)">订单查看</a>
                        <span style="padding-right: 2px;padding-left: 2px">|</span>
                        <a style="cursor: pointer;color: green"
                           onclick="update(${order.id})">签收</a>
                        <span style="padding-right: 2px;padding-left: 2px">|</span>
                        <a style="cursor: pointer;color: green;"
                           onclick="xadmin.open('订单评价','./ordersCommentHtml?id=${order.id}',1200,400)">评价</a>
                    </dd>
                    <hr>
                </c:forEach>
            </dl>
        </div>

        <div class="pagenation">
            <a class="active">1</a>
        </div>
    </div>
</div>
<!--内容  结束-->

<!--底部  开始-->
<jsp:include page="bottom.jsp"/>
<!--内容  结束-->
<script>
    function update(id) {
        $.ajax({
            url:"./updateOrders",
            type:"post",
            data:{orderStatus:3,id:id},
            success:function (res) {
                if (res.data === '修改成功'){
                    window.location.href="./getOrderHtml?userId=${sessionScope.user.id}";
                } else {
                    alert("签收失败")
                }
            },
            error:function () {
                alert("404页面.html");
            }
        });
    }
</script>
</body>
</html>
